#pragma once

#define PI 3.14159265358979323846
#define LIST(...) \
    { __VA_ARGS__ }

// TEST_DATA(input_shape,
//          pooled_height,
//          pooled_width,
//          spatial_scale,
//          sampling_ratio,
//          clockwise,
//          input_data,
//          rois_data,
//          batch_indices_data,
//          expected_output,
//          description)

// NOTE: expected output were generated using mmvc roi_align_rotated implementation.
TEST_DATA(LIST(2, 1, 8, 8),
          2,
          2,
          1.0f,
          2,
          true,
          LIST(0,
               1,
               8,
               5,
               5,
               2,
               0,
               7,
               7,
               10,
               4,
               5,
               9,
               0,
               0,
               5,
               7,
               0,
               4,
               0,
               4,
               7,
               6,
               10,
               9,
               5,
               1,
               7,
               4,
               7,
               10,
               8,
               2,
               0,
               8,
               3,
               6,
               8,
               10,
               4,
               2,
               10,
               7,
               8,
               7,
               0,
               6,
               9,
               2,
               4,
               8,
               5,
               2,
               3,
               3,
               1,
               5,
               9,
               10,
               0,
               9,
               5,
               5,
               3,
               10,
               5,
               2,
               0,
               10,
               0,
               5,
               4,
               3,
               10,
               5,
               5,
               10,
               0,
               8,
               8,
               9,
               1,
               0,
               7,
               9,
               6,
               8,
               7,
               10,
               9,
               2,
               3,
               3,
               5,
               6,
               9,
               4,
               9,
               2,
               4,
               5,
               5,
               3,
               1,
               1,
               6,
               8,
               0,
               5,
               5,
               10,
               8,
               6,
               9,
               6,
               9,
               1,
               2,
               7,
               1,
               1,
               3,
               0,
               4,
               0,
               7,
               10,
               2),
          LIST(3.5, 3.5, 2, 2, 0, 3.5, 3.5, 2, 2, 0),
          LIST(0, 1),
          LIST(3, 3.75, 4.75, 5, 3, 5.5, 2.75, 3.75),
          "roi_align_rotated_angle_0");
TEST_DATA(LIST(1, 1, 2, 2),
          2,
          2,
          1.0f,
          2,
          true,
          LIST(1, 2, 3, 4),
          LIST(0.5, 0.5, 1, 1, 0),
          LIST(0),
          LIST(1.0, 1.25, 1.5, 1.75),
          "roi_align_rotated_simple_angle_0");
TEST_DATA(LIST(1, 1, 2, 2),
          2,
          2,
          1.0f,
          2,
          false,
          LIST(1, 2, 3, 4),
          LIST(0.5, 0.5, 1, 1, PI / 2),
          LIST(0),
          LIST(1.5, 1.0, 1.75, 1.25),
          "roi_align_rotated_simple_angle_PI/2");
TEST_DATA(LIST(1, 1, 2, 2),
          2,
          2,
          1.0f,
          2,
          false,
          LIST(1, 2, 3, 4),
          LIST(0.5, 0.5, 1, 1, PI, 0.5, 0.5, 1, 1, 2 * PI),
          LIST(0, 0),
          LIST(1.75, 1.5, 1.25, 1.0, 1.0, 1.25, 1.5, 1.75),
          "roi_align_rotated_batch_idx_test");
TEST_DATA(LIST(1, 2, 2, 2),
          2,
          2,
          1.0f,
          2,
          false,
          LIST(1, 2, 3, 4, 4, 3, 2, 1),
          LIST(0.5, 0.5, 1, 1, 0),
          LIST(0),
          LIST(1.0, 1.25, 1.5, 1.75, 4.0, 3.75, 3.5, 3.25),
          "roi_align_rotated_channels_test");
TEST_DATA(LIST(1, 1, 5, 5),
          3,
          1,
          1.0f,
          2,
          true,
          LIST(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25),
          LIST(1, 1, 4, 4, 0),
          LIST(0),
          LIST(0.8750, 4.2500, 10.9167),
          "roi_align_rotated_box_outside_feature_map_top_left");
TEST_DATA(LIST(1, 1, 5, 5),
          3,
          1,
          1.0f,
          2,
          true,
          LIST(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25),
          LIST(1, 1, 4, 4, PI / 4),
          LIST(0),
          LIST(2.6107, 4.6642, 6.8819),
          "roi_align_rotated_box_outside_feature_map_top_left_angle_PI/4");
TEST_DATA(LIST(1, 1, 5, 5),
          3,
          1,
          1.0f,
          2,
          true,
          LIST(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25),
          LIST(5, 5, 4, 4, 0),
          LIST(0),
          LIST(10.1667, 12.2500, 0.0),
          "roi_align_rotated_box_outside_feature_map_bottom_right_angle_0");
TEST_DATA(LIST(1, 1, 5, 5),
          3,
          1,
          1.0f,
          2,
          true,
          LIST(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25),
          LIST(5, 5, 1, 5, PI / 4),
          LIST(0),
          LIST(0.0, 25.0, 0.0),
          "roi_align_rotated_box_outside_feature_map_bottom_right_angle_PI/4");
TEST_DATA(LIST(1, 1, 5, 5),
          2,
          2,
          1.0f,
          0,
          true,
          LIST(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25),
          LIST(3, 3, 4, 4, 0),
          LIST(0),
          LIST(10.0, 12.0, 20.0, 22.0),
          "roi_align_rotated_box_outside_sampling_ratio_auto");
TEST_DATA(LIST(1, 1, 5, 5),
          2,
          2,
          0.25f,
          0,
          true,
          LIST(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25),
          LIST(3, 3, 4, 4, 0),
          LIST(0),
          LIST(1.0, 1.5, 3.5, 4.0),
          "roi_align_rotated_box_outside_sampling_ratio_auto_scale_0.25");
TEST_DATA(LIST(1, 1, 5, 5),
          2,
          2,
          2.0f,
          0,
          true,
          LIST(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25),
          LIST(3, 3, 4, 4, 0),
          LIST(0),
          LIST(20.5, 0.0, 0.0, 0.0),
          "roi_align_rotated_box_outside_sampling_ratio_auto_scale_2");
TEST_DATA(LIST(1, 1, 5, 5),
          5,
          2,
          0.78f,
          0,
          false,
          LIST(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25),
          LIST(3, 1, 4, 2, PI / 3),
          LIST(0),
          LIST(5.1271, 1.2473, 6.1773, 2.9598, 7.2275, 3.2300, 8.2777, 3.7458, 9.3279, 4.4060),
          "roi_align_rotated_all_features");
TEST_DATA(LIST(1, 1, 2, 5),
          2,
          2,
          1.0f,
          2,
          true,
          LIST(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
          LIST(0.5, 0.5, 1, 1, 0),
          LIST(0),
          LIST(1.0, 1.25, 2.25, 2.50),
          "input_image_not_rectangular");
TEST_DATA(LIST(2, 1, 2, 5),
          2,
          2,
          1.0f,
          2,
          true,
          LIST(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20),
          LIST(0.5, 1., 2., 5., 0.5, 0., 2., 5., 1., 0.),
          LIST(0, 1),
          LIST(0.5201, 1.9866, 2.5219, 3.0896, 0.0000, 16.7500, 0.0000, 16.7500),
          "input_image_not_rectangular_batch_2");

#undef PI
#undef LIST
